package com.wyh.service.serviceImpl.feemanagementserviceimpl;


import com.wyh.domain.po.feemanagementpo.Resourcees;
import com.wyh.mapper.feemanagementmapper.ResourceMapper;
import com.wyh.service.feemanagementservice.BillService;
import com.wyh.service.feemanagementservice.IResourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;


/**
 * <p>
 * 资源表 服务实现类
 * </p>
 *
 * @author ggt
 * @since 2024-05-21
 */
@Service
@RequiredArgsConstructor
public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resourcees> implements IResourceService {


    @Override
    //楼层的资源
    public List<Resourcees> getResourceListByBuildingUtilId(Integer floorId) {
        List<Resourcees> resourcees = lambdaQuery()
                .eq(Resourcees::getBuildingid, floorId).list();
        if(resourcees.isEmpty()){
            return Collections.emptyList();
        }
        return resourcees;
    }

    @Override
    public List<Resourcees> listByType(Integer type) {
        List<Resourcees> resourcees = lambdaQuery().eq(Resourcees::getType, type).list();
        //判断是否为空
        if (resourcees.isEmpty()) {
            return Collections.emptyList();
        }
        return resourcees;
    }

    @Override
    public Resourcees getResourceByBuildingid(Integer i) {
        return lambdaQuery().eq(Resourcees::getBuildingid, i).one();
    }





}

